<%@ page import="com.wzy.Jdbc封装.pojo.News_user" %>
<%@ page import="java.util.List" %>
<jsp:useBean id="user" class="com.wzy.level.user.userServiceImpl.userServiceImpl" />
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div>
  <h1>news_user表</h1>
  <table>
<%--    <%--%>
<%--      List<News_user> news_users = user.selectAll();--%>
<%--      for(int i = 0; i<news_users.size();++i){--%>


<%--    %>--%>
<%--    <tr>--%>
<%--      <td><%=news_users.get(i).getId()%></td>--%>
<%--      <td><%=news_users.get(i).getUserName()%></td>--%>
<%--      <td><%=news_users.get(i).getPassword()%></td>--%>
<%--      <td><%=news_users.get(i).getEmail()%></td>--%>
<%--      <td><%=news_users.get(i).getUserType()%></td>--%>
<%--      <td><a href="user_del.jsp?id=<%=news_users.get(i).getId()%>">删除</a></td>--%>
<%--      <td><a href="user_insert_update.jsp?state=0&id=<%=news_users.get(i).getId()%>">修改</a></td>--%>
<%--      <td><a href="user_insert_update.jsp?state=1&id=<%=news_users.get(i).getId()%>">新增</a></td>--%>
<%--    </tr>--%>

<%--    <%--%>
<%--      }--%>
<%--    %>--%>
        现在有${counts}人在线
      <c:forEach var="user" items="${sessionScope.news_users_byPage}" varStatus="id"  end="${sessionScope.total}">
          <tr >
          <%--分开判断就可以隔行不一样的颜色--%>
          <c:if test="${id.count % 2 !=0}">
              <tr bgcolor="#F1A8A8FF">
          </c:if>
          <c:if test="${id.count % 2 ==0}">
              <tr bgcolor="#DFB3F6CC">
          </c:if>
          <td style="width: 50px">${user.id}</td>
          <td style="width: 100px">${user.userName}</td>
          <td style="width: 100px">${user.password}</td>
          <td style="width: 150px">${user.email}</td>
          <td style="width: 250px">${user.userType}</td>
          <td><a href="/user_delete?id=${user.id}">删除</a></td>
          <td><a href="/user_insert_updateServlet?state=0&id=${user.id}">修改</a></td>
          <td><a href="/user_insert_updateServlet?state=1&id=${user.id}">新增</a></td>
          </tr>
      </c:forEach>
    <tr>
        <td><a href="/pageManage?index=1&count=${sessionScope.count}&cate=2">首页</a></td>
        <td style="width: 100px"><a href="/pageManage?index=${(sessionScope.index-1)<0? 0:(index-1)}&count=${sessionScope.count}&cate=2">&lt;&lt;上一页</a></td>
        <td><a href="/pageManage?index=${(sessionScope.index+2)}&count=${sessionScope.count}&cate=2">下一页&gt;&gt;</a></td>
        <td><a href="/pageManage?index=${totalPage}&count=${sessionScope.count}&cate=2">尾页</a></td>
        <td>第${sessionScope.index+1}页</td>
        <td>共${(total % sessionScope.count == 0) ? totalPage : totalPage+1}页</td>
        <td>共${total}条记录</td>
        <td>
            <form action="/pageManage" method="get" style="margin: 0 auto">
                一页查<input type="text" name="count" style="width: 50px" >条数据&nbsp;
                <input type="text" name="cate" style="width: 50px" value="2" hidden >
                跳转至
                <input type="text" name="index" style="width: 50px"  >
                页
                <input type="submit" value="GO">
            </form>
        </td>


    </tr>

  </table>
</div>
</body>
</html>
